import org.springframework.stereotype.Service
import javax.annotation.Resource

@Service
class UserService {
    @Resource
    private lateinit var userMapper: UserMapper

    fun saveUser(user: User): Int {
        return userMapper.insert(user)
    }

    fun getUserById(id: Long): User? {
        return userMapper.selectById(id)
    }

    fun getAllUsers(): List<User> {
        return userMapper.selectList(null)
    }
}    